//导入request.js请求工具类
import request from '@/utils/request';

//可以将传入的参数转换成参数
function parseJson(JsonData)
{
    //借助工具
    const params = new URLSearchParams();
    for(let key in JsonData)
    {
        params.append(key,JsonData[key]);
    }
    return params;
}

//提供调用接口的函数
export const UserRegisterService = (registerData) =>
{
    return request.post('/user/register', registerData);
}

export const UserLoginService = (loginData) =>
{
    return request.post('/user/login', loginData);
}
export const UserUpdateService = (updateData) =>
{
    return request.put('/user/update', updateData);
}

export const AllergenService = () =>
{
    return request.get('/user/allergen');
}
export const DiseaseService = () =>
{
    return request.get('/user/disease');
}
export const PreferenceService = () =>
{
    return request.get('/user/preference');
}
export const UserTypeService = () =>
{
    return request.get('/user/type');
}

export const UserScoreService = (memberId) =>
{
    return request.get('/user/score',{params:{memberId}});
}
//获取用户提交的体检报告记录
export const UserReportService = () =>
{
    return request.get('/user/report');
}